#include<stdio.h>
int main()
{ 
    int n;
    scanf("%d",&n);
     int count=1;
     int j=n;
     while(n>0)
     {
        int an=n%2;
        n=n/2;
        if(count%2==0)
        {
            printf("%d ",an);
        }
        count++;
     }
     printf("\n");
     count=1;
     while(j>0)
     {
        int an=j%2;
        j=j/2;
        if(count%2!=0)
        {
            printf("%d ",an);
        }
        count++;
     }
    return 0;
}